<?php $this->placeholder('onReady')->captureStart() ?>
	$("#myTable").tablesorter(); 
    
    $("#myTable").on("mouseenter",'.jTipImg', function(e){        
         $(this).closest('tr').addClass('ui-state-focus');
    })
    
    
     $(document).on("click",'.borrar', function(e){        
    	e.preventDefault();
    	var url=this.href;
        var tr = $(this).closest('tr');
    
	       $.post(url,  function(data){
						if(data.status=='ok'){
							tr.hide();
						}else if(data.status=='reload'){
						      location.reload();
						}else
						{
							$('#dialog').html(data).dialog("open").dialog({title:''});
						}
	      })
    })
    
    $('.borrar').css('cursor','pointer')
    .button({
            text: false,
            icons: {
                primary: "ui-icon-trash"
            }
    });
    
    
    
<?php $this->placeholder('onReady')->captureEnd() ?>

<style>
.jTipImg{display:inline;cursor:pointer;color:#990000}
</style>

<div class="contenedor_tablesorter">
    <?if($this->rows):?>
    
   <?  print $this->anchor("/rss/mail/id/".$this->md5,'Suscribete '. $this->img('/img/rss.png'), null,false);?>

    
    <table id="myTable" width="100%" class=""> 
        <?echo $this->partial('snnipet/caption.phtml',array('c'=>count($this->rows)));?>
        <thead>
        <tr align="fila_">
            <th><?php echo $this->translate('From');?></th>
            <th><?php echo $this->translate('Asunto');?></th>
            <th><?php echo $this->translate('Recibido');?></th>
            <th><?php echo $this->translate('Leido');?></th>
        </tr>
        </thead>
        <tbody>
           <?foreach($this->rows as $k => $v):?>
           <tr id="fila_<?=$k?>" class="<?=!$v['leido'] ? 'ui-state-focus' : ''?>">
           <td><?=$this->user($v['created_by'])?></td>
           <td><?=$this->actiontip($v['url'],$v['asunto'],array('id'=>'mail_'.$v['id']))?></td>
           <td><?=$this->dateTo($v['created_on'],'dd/MM/yyyy HH:mm')?></td>
           <td><?=$this->dateTo($v['f_leido'],'dd/MM/yyyy HH:mm')?></td>
           <td><a href="/mail/borrar/id/<?=$v['id']?>_<?=$v['id_para']?>" class="borrar">Borrar</a></td>
           </tr>
          <?endforeach?>	
        </tbody>
    </table>
    <?endif?>
</div>
